package com.bestv.bsr.core.service.impl.hb.remote;

import com.bestv.bsr.core.service.impl.hb.fallback.HBFallbackHandler;
import com.bestv.remote.annotation.RemoteFunction;
import com.bestv.remote.annotation.RemoteParam;
import com.bestv.remote.annotation.RemoteService;
import com.bestv.remote.enums.ParamType;
import org.springframework.http.HttpMethod;
import org.springframework.validation.annotation.Validated;

import java.util.Map;

/**
 * 湖北移动远程服务
 *
 * @author taojiacheng
 */
@Validated
@RemoteService(baseUrl = "${recommend.hb.baseurl}", targetServerName = "HBYD")
public interface HBRemoteService {

    /**
     * 湖北移动 智能推荐接口
     *
     * @param params          请求参数
     * @param recommendMethod 推荐方式
     * @return resp
     */
    @RemoteFunction(value = "/recommend/{recommendMethod}", method = HttpMethod.POST,
            cacheable = true, expireIn = "recommend.hb.expiration",
            sentinelResource = "HB", fallback = HBFallbackHandler.class, block = HBFallbackHandler.class)
    String recommend(@RemoteParam(name = "params", type = ParamType.FORM) Map<String, String> params,
                     @RemoteParam(name = "recommendMethod", type = ParamType.PATH) String recommendMethod,
                     @RemoteParam(name = "cacheKey", type = ParamType.CACHE_KEY) String cacheKey);

}
